package com.sxz.sbs.module.client.adapter;

import android.support.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.sxz.sbs.R;
import com.sxz.sbs.entity.AuthorityEntity;
import com.sxz.sbs.module.client.bean.ClientManagementBean;
import java.util.List;

/**
 * 客户管理
 */

public class ClientManagementAdapter extends BaseQuickAdapter<AuthorityEntity,BaseViewHolder>{

    public ClientManagementAdapter(@Nullable List<AuthorityEntity> data) {
        super(R.layout.item_clientmanagemen_layout,data);
    }

    @Override
    protected void convert(BaseViewHolder helper, AuthorityEntity item) {
        helper.setText(R.id.tv_houses,item.getTxt_Name());
        helper.setText(R.id.tv_introduce,item.getTxt_Description());
        helper.setImageResource(R.id.img_client,getDrawableId(item.getIc_Path()));
    }

    private int getDrawableId (String name) {
        try {
            return mContext.getResources().getIdentifier(name, "drawable", mContext.getPackageName());
        }catch (Exception e) {

        }
        return 0;
    }
}
